﻿<extend name="Public:base" />
<block name="title"><title>找回密码</title></block>
<block name="header_styles">
    <style type="text/css">
        .main-wrapper .container {
            background-color: #ffffff;
        }
    </style>
</block>
<block name="main">
    <br /><br /><br />
    <div style="width:800px;margin:auto;">
        <div style="border-bottom: 1px solid #dedede;font-size: 2rem; ">请输入您要找回密码的账号</div>
        <div style="padding:50px 200px;">
            <form method="POST" id="resetpwdstep1">
                <input type="text" id="email" name="email" value="" class="form-control" style="height:50px;font-size: 1.5rem;" data-val="true" data-val-required="请输入账号" placeholder="输入账号" />
                <span data-valmsg-for="email" data-valmsg-replace="true"></span>
                <div class="text-danger" id="lblNotic"></div>
                <br />
                <div class="text-center">
                    <input type="submit" id="submitbtn" value="下一步" class="btn-success btn" style="width: 100%;height: 50px; font-size: 1.6rem;" />
                </div>
            </form>
        </div>
    </div>
</block>
<block name="footer_scripts">
    <script type="text/javascript">
        require(["jquery"], function ($) {
            $('#submitbtn').on("click", function () {
                if (!$("#resetpwdstep1").valid()) {
                    return false;
                }
                $("#lblNotic").text("");
                var url = "{:U('Login/signup_checkEmailAjax')}";
                var email = $('#email').val();
                $.post(url, { 'email': email }, function (data) {
                    console.log(data);
                    var bret = eval(data);
                    if (!bret) {
                        window.location.href = "{:U('Login/resetpwd', array('step'=>2), '')}-email-" + email;
                    }
                    else {
                        $("#lblNotic").text("无效的邮箱地址!");
                    }
                }, 'json');
                return false;
            });
        });
    </script>

</block>
